package com.example.animationviewdemo;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class MyAnimViewAdapter extends BaseAnimViewAdapter {

	@Override
	public int getViewTypeCount() {
		return 2;
	}

	Context context;
	List<String> strList;

	public MyAnimViewAdapter(Context context, List<String> strList) {
		super();
		this.context = context;
		this.strList = strList;
	}

	@Override
	public int getCount() {
		if (strList == null)
			return 0;
		return strList.size();
	}

	@Override
	public Object getItem(int position) {
		if (strList == null || strList.size() == 0)
			return null;
		return strList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = LayoutInflater.from(context).inflate(
					R.layout.anim_layout, parent, false);
		}
		TextView text = (TextView) convertView.findViewById(R.id.text);
		text.setText(strList.get(position));
		return convertView;
	}

	@Override
	public int getItemViewType(int position) {
		return IGNORE_ITEM_VIEW_TYPE;
	}

}
